Chat API
Chat service API Documentation
Version: 1.0.7
Paths
/aiwb/chat/api/v1/healthz
- Method: GET
- Summary: Health
- Description: Return Health Status. :return:
- Operation ID: health_aiwb_chat_api_v1_healthz_get
- Responses:
- 200:
- Description: Successful Response
- Content-Type: application/json
- 200:
List Chats
- Endpoint:
/aiwb/chat/api/v1/
- Method:
GET
- Summary: List Chat
- Description: Retrieve a list of chats along with details on any guard rails violations associated with each chat. Guard rails violations refer to policy or rule violations flagged or monitored within chat interactions.
- Operation ID:
List_Chat_aiwb_chat_api_v1__get
Request Payload:
Type | Parameter | Description | Data Type | is_optional |
---|---|---|---|---|
Query Parameter | chat_bot_id | ID associated with chat bot | string | mandatory |
Query Parameter | page_no | Specifies the page number to retrieve (1-based index) | int | mandatory |
Query Parameter | page_size | Specifies the number of items per page | int | mandatory |
Sample code
import requests
URL = "https://api.kadal.ai/aiwb/chat/api/v1/"
# sample python code
headers = { "Authorization ": "Bearer 1234567890" }
params={
"chat_bot_id":"string",
"page_no":1,
"page_size":10,
"order":"asc/desc",
"ext_user_id_ref":"string"
}
response = requests.get(URL, headers=headers,params=params)
print(response)
Example response -
{
"status_code": 200,
"data": [
{
"chat_bot_id": "12345ewdwe122",
"user_query": "Hello",
"created_by": 1,
"bot_response_id": 1,
"bot_response": "How Can I Assist you Today?"
}
],
"total_skill_count": 5
}
Responses:
Status Code | Description | Content-Type |
---|---|---|
200 | Resource Created | application/json |
400 | Bad Request | application/json |
404 | Resource Not Found | application/json |
403 | Forbidden | application/json |
500 | Internal Server Error | application/json |
422 | Validation Error | application/json |
Get Chat by Bot ID
Endpoint:
/aiwb/chat/api/v1/{chat_bot_id}
Method:
GET
- Summary: Get Chat
- Description: Retrieve a list of chats using a specific chat bot ID.
- Operation ID:
Get_Chat_aiwb_chat_api_v1__chat_bot_id__get
Request Payload:
Type | Parameter | Description | Data Type | is_optional |
---|---|---|---|---|
parameter | chat_bot_id | Identifier of the chat bot | string | mandatory |
parameter | query | Query for the chat | string | mandatory |
Sample code
import requests
URL = "https://api.kadal.ai/aiwb/chat/api/v1/{chat_bot_id}"
# sample python code
headers = { "Authorization ": "Bearer 1234567890" }
params={
"chat_bot_id":"string",
"query":"string",
"continue_last_chat":bool,
"ext_user_id_ref":"string"
}
response = requests.get(URL, headers=headers,params=params)
print(response)
Example response -
{
"status_code": 200,
"message_id": 1,
"message": "Hello"
}
Responses:
Status Code | Description | Content-Type |
---|---|---|
200 | Resource Created | application/json |
204 | Not Found | application/json |
400 | Bad Request | application/json |
403 | Forbidden | application/json |
404 | Resource Not Found | application/json |
507 | Insufficient Token | application/json |
500 | Internal Server Error | application/json |
422 | Validation Error | application/json |
Clear Chat History by Bot ID
Endpoint:
/aiwb/chat/api/v1/clearhistory/{chat_bot_id}
Method:
POST
- Summary: Clear Chat History
- Description: Facilitates the removal of chat history associated with a specific user within the context of a chat bot. This action effectively archives or deletes conversations linked to the user's interactions with the designated chat bot.
- Operation ID:
clear_chat_history_aiwb_chat_api_v1_clearhistory__chat_bot_id__post
Request Payload:
Type | Parameter | Description | Data Type | is_optional |
---|---|---|---|---|
parameter | chat_bot_id | Identifier of the chat bot | string | mandatory |
Sample code
import requests
URL = "https://api.kadal.ai/aiwb/chat/api/v1/clearhistory/{chat_bot_id}"
# sample python code
headers = { "Authorization ": "Bearer 1234567890" }
params={
"chat_bot_id":"string"
}
response = requests.post(URL, headers=headers,params=params)
print(response)
Example response -
{
"status_code": 200,
"message": "Deleted previous conversations."
}
Responses:
Status Code | Description | Content-Type |
---|---|---|
200 | Success | application/json |
400 | Connection Error | application/json |
403 | Unauthorized Access | application/json |
404 | Not Found | application/json |
500 | Internal Server Error | application/json |
422 | Validation Error | application/json |
Post Chat by Bot ID
Endpoint:
/aiwb/chat/api/v2/{chat_bot_id}
Method:
POST
- Summary: Post Chat
- Description: Empowers users to build interactive chat experiences with features for managing conversation flow and generating AI-powered responses to user queries.
- Operation ID:
post_chat_aiwb_chat_api_v2__chat_bot_id__post
Request Payload:
Type | Parameter | Description | Data Type | is_optional |
---|---|---|---|---|
parameter | chat_bot_id | Identifier of the chat bot | string | mandatory |
Sample code
import requests
URL = "https://api.kadal.ai/aiwb/chat/api/v2/{chat_bot_id}"
# sample python code
headers = { "Authorization ": "Bearer 1234567890" }
params={
"chat_bot_id":"string",
"continue_last_chat":bool,
"ext_user_id_ref":"string"
}
response = requests.post(URL, headers=headers,params=params)
print(response)
Example response -
{
"status_code": 200,
"message_id": 1,
"message": "Hello"
}
Responses:
Status Code | Description | Content-Type |
---|---|---|
200 | Resource Created | application/json |
204 | Not Found | application/json |
400 | Bad Request | application/json |
403 | Forbidden | application/json |
404 | Resource Not Found | application/json |
507 | Insufficient Token | application/json |
500 | Internal Server Error | application/json |
422 | Validation Error | application/json |
Add Feedback API -
Endpoint:
/aiwb/chat/api/v1/feedbacks/
Method:
POST
- Summary: Add Feedback
- Description: Provides functionality to provide feedback on a bot response.
- Operation ID:
Add_Feedback_aiwb_chat_api_v1_feedbacks__post
Feedback Submission Payload:
Type | Parameter | Description | Data Type | is_optional |
---|---|---|---|---|
Query Parameter | bot_response_id | The ID of the bot response being rated. | integer | mandatory |
Query Parameter | is_positive | Indicates whether the feedback is positive (true ) or negative (false ). | boolean | mandatory |
Query Parameter | rating_id | The identifier representing the rating given to the bot response. | integer | mandatory |
Query Parameter | comment | Additional comments or feedback provided by the user. | string | optional |
Sample code
import requests
URL = "https://api.kadal.ai/aiwb/chat/api/v1/feedbacks/"
# sample python code
headers = { "Authorization ": "Bearer 1234567890" }
params={
"ext_user_id_ref":"string"
}
response = requests.post(URL, headers=headers,params=params)
print(response)
Example response -
{
"id": 0,
"bot_response_id": 0,
"is_positive": true,
"rating_id": 0,
"comment": "string"
}
Responses:
Status Code | Description | Content-Type |
---|---|---|
200 | Successful Response | application/json |
422 | Validation Error | application/json |
Components
Schemas
BotResponseFeedbackResp
- Type: object
- Description: Represents feedback on a bot response.
- Properties:
- id:
- Type: integer
- bot_response_id:
- Type: integer
- is_positive:
- Type: boolean
- rating_id:
- Type: integer
- comment:
- Type: string
- id:
ChatValidator
- Type: object
- Description: Represents a chat validator object.
- Properties:
- message:
- Type: string
- metadata:
- Type: object
- message:
FeedbackRequest
- Type: object
- Description: Represents a request for feedback on a bot response.
- Properties:
- bot_response_id:
- Type: integer
- Description: The ID of the bot response
- is_positive:
- Type: boolean
- Description: Indicates whether the response is positive (thumbs up) or negative (thumbs down)
- rating_id:
- Type: integer
- Description: The ID of the rating associated with the feedback
- comment:
- Type: string
- bot_response_id:
HTTPValidationError
- Type: object
- Description: Represents an HTTP validation error response.
- Properties:
- detail:
- Type: array
- detail:
Msg
- Type: object
- Description: Represents a message object.
- Properties:
- msg:
- Type: string
- msg:
Order
- Type: string
- Description: An enumeration representing order.
ResponseCommon
- Type: object
- Description: Represents a common response object.
- Properties:
- status_code:
- Type: integer
- message:
- Type: string
- status_code:
ResponseList
- Type: object
- Description: Represents a list response object.
- Properties:
- status_code:
- Type: integer
- total_count:
- Type: integer
- data:
- Type: array
- message:
- Type: string
- status_code:
ValidationError
- Type: object
- Description: Represents a validation error response.
- Properties:
- loc:
- Type: array
- msg:
- Type: string
- type:
- Type: string
- loc: